package fr.redak.dak;

import java.util.Arrays;

import org.bukkit.Material;
import org.bukkit.SkullType;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.SkullMeta;

public class Event implements Listener{

	public Main plugin;
	public Event(Main main) {
		this.plugin = main;
	}

	@EventHandler
	public void playerJoin(PlayerJoinEvent event){
		Player player = event.getPlayer(); 
		
		ItemStack tete = new ItemStack(Material.SKULL_ITEM, 1, (short) SkullType.PLAYER.ordinal());
		SkullMeta sm = (SkullMeta) tete.getItemMeta();
		sm.setDisplayName("§6Ma tête");
		sm.setLore(Arrays.asList("§bVoici ma"," §6Ma tête"));
		sm.setOwner(player.getName());
		tete.setItemMeta(sm);
		
		player.getInventory().addItem(tete);
		event.setJoinMessage("§4" + player.getName()  + "§9 à rejoint la tuerie !");
	}

}
